package com.nciae.po;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.nciae.enums.PayStatusEnum;
import com.nciae.enums.ProductStatusInfoEnum;
import com.nciae.utils.EnumUtil;
import com.nciae.utils.GeneratePrimeKey;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author YangChen
 * @since 2021-10-14
 */
@TableName("product_info")
public class ProductInfo implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "product_id")
    private String productId= GeneratePrimeKey.getkey();

    /**
     * 商品名称
     */
    @TableField(value = "product_name")
    private String productName;

    /**
     * 单价
     */
    @TableField(value = "product_price")
    private BigDecimal productPrice;

    /**
     * 库存
     */
    @TableField(value = "product_stock")
    private Integer productStock;

    /**
     * 描述
     */
    @TableField(value = "product_description")
    private String productDescription;

    /**
     * 小图
     */
    @TableField(value = "product_icon")
    private String productIcon;

    /**
     * 商品状态,0正常1下架
     */
    @TableField(value = "product_status")
    private Integer productStatus = ProductStatusInfoEnum.PUT.getCode();

    /**
     * 类目编号
     */
    @TableField(value = "category_type")
    private Integer categoryType;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date createTime = new Date();


    @JsonIgnore
    public ProductStatusInfoEnum getProductStatusEnum() {
        return EnumUtil.getByCode(productStatus, ProductStatusInfoEnum.class);
    }

    /**
     * 修改时间
     */
    @TableField(value = "update_time")
    private Date updateTime = new Date();

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }
    public String getProductName() {
        return productName;
    }

    public void setProductName(String productName) {
        this.productName = productName;
    }
    public BigDecimal getProductPrice() {
        return productPrice;
    }

    public void setProductPrice(BigDecimal productPrice) {
        this.productPrice = productPrice;
    }
    public Integer getProductStock() {
        return productStock;
    }

    public void setProductStock(Integer productStock) {
        this.productStock = productStock;
    }
    public String getProductDescription() {
        return productDescription;
    }

    public void setProductDescription(String productDescription) {
        this.productDescription = productDescription;
    }
    public String getProductIcon() {
        return productIcon;
    }

    public void setProductIcon(String productIcon) {
        this.productIcon = productIcon;
    }
    public Integer getProductStatus() {
        return productStatus;
    }

    public void setProductStatus(Integer productStatus) {
        this.productStatus = productStatus;
    }
    public Integer getCategoryType() {
        return categoryType;
    }

    public void setCategoryType(Integer categoryType) {
        this.categoryType = categoryType;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public String toString() {
        return "ProductInfo{" +
            "productId=" + productId +
            ", productName=" + productName +
            ", productPrice=" + productPrice +
            ", productStock=" + productStock +
            ", productDescription=" + productDescription +
            ", productIcon=" + productIcon +
            ", productStatus=" + productStatus +
            ", categoryType=" + categoryType +
            ", createTime=" + createTime +
            ", updateTime=" + updateTime +
        "}";
    }
}
